<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'payments-form',
	'enableAjaxValidation'=>false,
)); ?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

	<?php echo $form->errorSummary($model); ?>

	<div class="row">
		<?php echo $form->labelEx($model,'PaidDate'); ?>
		<?php //echo $form->textField($model,'PaidDate');

		$this->widget('zii.widgets.jui.CJuiDatePicker', array(
		'model'=>$model,
		'attribute'=>'PaidDate',
		//additional javascript options for the date picker plugin
		'options'=>array(
		'dateFormat'=>'yy-mm-dd',
		'showAnim'=>'fold',
		),
		'htmlOptions'=>array(
		
		),
		));
		
		
		?>
		<?php echo $form->error($model,'PaidDate'); ?>
	</div>

	<div class="row">
		<?php //echo $form->textField($model,'idOccupancy'); 
		if(!isset($_GET['pid']))
			echo $form->hiddenField($model,'idOccupancy');
			
		else{
			echo $form->labelEx($model,'idOccupancy'); 	
			foreach(Occupancy::model()->findAll('idRentalProperty=:condition',array(':condition'=>$pid)) as $occ){
		  $occlist[$occ->id] = $occ->idTenant0->iduser0->FirstName.' '.$occ->idTenant0->iduser0->LastName.' at '.$occ->idRentalUnit0->UnitNumber;
		}	
		echo $form->dropDownList($model,'idOccupancy',$occlist, 
array('prompt'=>'Choose'));
		}
		?>
		<?php echo $form->error($model,'idOccupancy'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'Amount'); ?>
		<?php echo $form->textField($model,'Amount'); ?>
		<?php echo $form->error($model,'Amount'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'Note'); ?>
		<?php echo $form->textField($model,'Note',array('size'=>50,'maxlength'=>50)); ?>
		<?php echo $form->error($model,'Note'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'idIncomeType'); ?>
		<?php echo $form->dropDownList($model,'idIncomeType', CHtml::listData(Incometype::model()->findAll('Category=:condition',array(':condition'=>urldecode($typ))), 'id', 'Name'), array('prompt'=>'Choose'));//echo $form->textField($model,'idIncomeType'); ?>
		<?php echo $form->error($model,'idIncomeType'); ?>
	</div>

	<div class="row">
	<?php if ($typ == 'Payment' || typ == 'Fee') {?>
		<?php echo $form->labelEx($model,'DueDate'); ?>
		<?php //echo $form->textField($model,'DueDate'); 
		$this->widget('zii.widgets.jui.CJuiDatePicker', array(

		'model'=>$model,
		'attribute'=>'DueDate',
		//additional javascript options for the date picker plugin
		'options'=>array(
		'dateFormat'=>'yy-mm-dd',
		'showAnim'=>'fold',
		),
		'htmlOptions'=>array(
		
		),
		));
		
		
		?>
		<?php echo $form->error($model,'DueDate'); ?>
	<?php }?>	
	</div>

	<div class="row buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? 'Add' : 'Save'); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->